package com.matongxue.ioc2;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.Resource; //jdk8

@Scope("prototype")
@Component("user2")
@Data
public class User {

    private String name;
    private int age;

    @Resource(name="car2")  //by id/name
    //@Autowired //by class
    private Car myCar;
}
